package com.example.music.service;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.example.music.dto.PageInfoBT;
import com.example.music.entity.User;
import com.example.music.mapper.UserMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author yinhuachang123
 * @since 2018-04-23
 */
@Service
public class UserService  extends ServiceImpl<UserMapper, User> {
    public PageInfoBT<User> getUserList(String userName,Page page){
        EntityWrapper<User> ew = new EntityWrapper<User>();
        ew.setEntity(new User());
        if(StringUtils.isNotBlank(userName)){
            ew.like("userName",userName);
        }
        System.out.println(ew.getSqlSegment());
        PageInfoBT<User> pageInfoBT = new PageInfoBT<User>(this.selectPage(page,ew));
        return pageInfoBT;
    }
}
